#include <ros/ros.h>
#include <tf/transform_broadcaster.h>
#include <tf/transform_listener.h>

int main(int argc, char** argv){


  ros::init(argc, argv, "costmapfixedframe_broadcaster");
  ros::NodeHandle node;
  tf::TransformListener listener;
  tf::TransformBroadcaster br;
  ros::Rate rate(80.0);
  
  while (node.ok()){
    tf::StampedTransform transform_in;

    //得到坐标odom和坐标base_link之间的关系
    listener.waitForTransform("odom", "base_link", ros::Time(0), ros::Duration(3.0));
    listener.lookupTransform("odom", "base_link",
                            ros::Time(0), transform_in);

    
    tf::Transform transform;
    transform.setOrigin( tf::Vector3(transform_in.getOrigin().x(), transform_in.getOrigin().y(), transform_in.getOrigin().z()) );
    transform.setRotation( tf::Quaternion(0, 0, 0, 1) );
    br.sendTransform(tf::StampedTransform(transform, ros::Time::now(), "odom", "costmap_fixedframe"));
    rate.sleep();
  }

  return 0;
};